package com.itjeffrey.autocode.bo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.itjeffrey.autocode.common.PageForm;
import org.springframework.security.core.GrantedAuthority;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 实体类
 * @author: admin
 * @date: 2021-03-28 12:33:57
 */
public class ResInfoTbBO extends PageForm<ResInfoTbBO> implements Serializable, GrantedAuthority {

    private static final long serialVersionUID = 1L;

    public ResInfoTbBO(){}

    public ResInfoTbBO(String resName){
        this.resName = resName;
    }

    /**
     * 资源ID
     */
    private Integer resId;

    /**
     * 资源名称
     */
    @NotNull(message = "资源名称不允许为空")
    private String resName;

    /**
     * 资源路径
     */
    @NotNull(message = "资源路径不允许为空")
    private String resUrl;

    /**
     * 资源类型
     */
    @NotNull(message = "资源类型不允许为空")
    private String resType;

    /**
     * 资源描述
     */
    private String resDesc;

    /**
     * 角色ID
     */
    private Integer roleId;

    /**
     * 登录名
     */
    private String loginName;

    /**
     * 扩展字段3
     */
    private String extData3;

    /**
     * 是否启用
     */
    private boolean enabled;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date updateTime;

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public void setResId(Integer resId){
        this.resId = resId;
    }

    public Integer getResId(){
        return this.resId;
    }

    public void setResName(String resName){
        this.resName = resName;
    }

    public String getResName(){
        return this.resName;
    }

    public void setResUrl(String resUrl){
        this.resUrl = resUrl;
    }

    public String getResUrl(){
        return this.resUrl;
    }

    public void setResType(String resType){
        this.resType = resType;
    }

    public String getResType(){
        return this.resType;
    }

    public void setResDesc(String resDesc){
        this.resDesc = resDesc;
    }

    public String getResDesc(){
        return this.resDesc;
    }

    public void setExtData3(String extData3){
        this.extData3 = extData3;
    }

    public String getExtData3(){
        return this.extData3;
    }

    public void setCreateTime(Date createTime){
        this.createTime = createTime;
    }

    public Date getCreateTime(){
        return this.createTime;
    }

    public void setUpdateTime(Date updateTime){
        this.updateTime = updateTime;
    }

    public Date getUpdateTime(){
        return this.updateTime;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    @Override
    public String getAuthority() {
        return resName;
    }

    @Override
    public String toString() {
        return "ResInfoTbBO{" +
                "resId=" + resId +
                ", resName='" + resName + '\'' +
                ", resUrl='" + resUrl + '\'' +
                ", resType='" + resType + '\'' +
                ", resDesc='" + resDesc + '\'' +
                ", roleId=" + roleId +
                ", loginName='" + loginName + '\'' +
                ", extData3='" + extData3 + '\'' +
                ", enabled=" + enabled +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}
